package com.crazymo.moskin.core;

import android.support.v7.app.AppCompatActivity;
import android.support.v7.app.AppCompatDelegate;

import java.util.Observable;
import java.util.Observer;

/**
 * @author : Crazy.Mo
 */
public class BaseSkinActivity extends AppCompatActivity implements Observer {

    @Override
    public void update(Observable o, Object arg) {
        if((boolean) Util.SharePreference.get(this,"config_skin","isNight",false)) {
            AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
            Util.SharePreference.save(this,"config_skin","isNight",true);
        }else {
            AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
            Util.SharePreference.save(this,"config_skin","isNight",false);
        }
        recreate();
        /////SkinManager.getInstance().restart();
    }

}
